$(document).ready(function () {
    //初始化表格
    initTable();
});

/**
 * 初始化表格
 */
function initTable() {
    var gh = $(window).height() - 145;
    //渲染表格骨架
    $("#table").jqGrid({
        url: 'http://localhost:8080/student/queryAllStudent1?m=' + Math.random(),
        datatype: "json",
       // postData: postData,
        colNames: ['名字','年级','年龄','id'],
        colModel: [
            {name: "name", width: 100},
            {name: "grade", width: 100},
            {name: "age", width: 80},
            {name: "id", hidden: true}
        ],
        viewrecords: true,
        loadComplete: function (data) {
            console.info(data);
            var width = $(window).width() - 23;
            $(this).setGridWidth(width);
        },
        shrinkToFit: false,
        autoScroll: true,
        height: gh,
        jsonReader: {id: "id", root: "resultList"}
    });
    $("#table").jqGrid("navGrid", "#pagerBar");
}